<?php
/**
 * Created by PhpStorm.
 * User: 盛茂国
 * Tel: 18394333958
 * Date: 2020/6/2
 * Time: 10:31
 */
namespace app\api\controller;


use app\admin\command\Api;
use think\Request;

class Catcoin extends Api
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    //猫币分享接口
    public function share(Request $request){
        if(!$request->isPost()) return ;
        $openid=$request->param('openid');
        $isSuccess=db('user')->where('open_id','=', $openid)->setInc('sharenum', 1);
        if($isSuccess){
            return json(['code'=>200,'msg'=>'分享成功']);
        }else{
            return json(['code'=>400,'msg'=>'分享失败']);
        }
    }
}